package zhongbo.java.air.web.controller;//package zhongbo.java.air.web.controller;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.PageRequest;
//import org.springframework.format.annotation.DateTimeFormat;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//import zhongbo.java.air.model.AirFlightPath;
//import zhongbo.java.air.service.AirFlightPathService;
//
//import javax.annotation.Resource;
//import javax.validation.Valid;
//import java.util.Date;
//
///**
// * 飞行轨迹记录表(AirFlightPath)表控制层
// *
// * @author makejava
// * @since 2025-04-02 09:30:50
// */
//@RestController
//@RequestMapping("airFlightPath")
//@Api(tags = "航迹服务")
//public class AirFlightPathController {
//    /**
//     * 服务对象
//     */
//    @Autowired
//    private AirFlightPathService airFlightPathService;
//
//    /**
//     * 分页查询
//     *
//     * @param PageNum 页码
//     * @param PageSize      大小
//     * @return 查询结果
//     */
//    @GetMapping
//    @ApiOperation(value = "分页查询", notes = "根据查询消息分页返回列表")
//    public Page<AirFlightPath> queryByPage(@RequestParam Integer PageNum, @RequestParam Integer PageSize){
//        return airFlightPathService.queryByPage(PageNum, PageSize);
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @GetMapping("{id}")
//    @ApiOperation(value = "用户查询", notes = "通过主键查询单条数据")
//    public ResponseEntity<AirFlightPath> queryById(@PathVariable("id") String id) throws Exception {
//        return ResponseEntity.ok(this.airFlightPathService.queryById(id));
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param airAlertZone 实体
//     * @return 新增结果
//     */
//    @PostMapping
//    @ApiOperation(value = "新增数据", notes = "新增单条数据")
//    public ResponseEntity<AirFlightPath> add(@RequestBody @Valid AirFlightPath airAlertZone) throws Exception {
//        return ResponseEntity.ok(this.airFlightPathService.insert(airAlertZone));
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param airAlertZone 实体
//     * @return 编辑结果
//     */
//    @PutMapping
//    @ApiOperation(value = "修改数据", notes = "修改单条数据")
//    public ResponseEntity<AirFlightPath> edit(@RequestBody @Valid AirFlightPath airAlertZone) throws Exception {
//        return ResponseEntity.ok(this.airFlightPathService.update(airAlertZone));
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param id 主键
//     * @return 删除是否成功
//     */
//    @DeleteMapping
//    @ApiOperation(value = "删除数据", notes = "删除单条数据")
//    public ResponseEntity<Boolean> deleteById(@RequestParam String id) throws Exception {
//        return ResponseEntity.ok(this.airFlightPathService.deleteById(id));
//    }
//
//    /**
//     * 根据 icao_code 和 startTime, endTime 查询指定飞机的航迹信息分页列表
//     *
//     * @param icaoCode icao_code
//     * @param startTime 开始时间
//     * @param endTime 结束时间
//     * @param PageNum 页面
//     * @param PageSize 大小
//     * @return 查询结果
//     */
//    @GetMapping("queryByIcaoAndTimestamp")
//    @ApiOperation(value = "查询指定飞机数据的航迹信息分页列表", notes = "查询指定飞机数据的航迹信息分页列表")
//    public Page<AirFlightPath> queryByIcaoAndTimestamp(
//            @RequestParam String icaoCode,
//            @ApiParam(value = "开始时间", example = "2023-01-01 00:00:00.000") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") Date startTime,
//            @ApiParam(value = "结束时间", example = "2025-12-31 23:59:59.999") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") Date endTime,
//            @RequestParam Integer PageNum, @RequestParam Integer PageSize) {
//        return airFlightPathService.queryByIcaoAndTimestamp(icaoCode, startTime, endTime, PageNum, PageSize);
//    }
//}


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import zhongbo.java.air.common.vo.PageVo;
import zhongbo.java.air.common.vo.ResultVo;
import zhongbo.java.air.model.AirFlightPath;
import zhongbo.java.air.service.AirFlightPathService;

/**
 * 说明：
 *
 * @author 钟波dellNotebook
 * @since 2025年04月01日 星期二 22:20:56
 */
@RestController
@RequestMapping("flightPath")
@Api(tags = "航迹数据接口")
public class AirFlightPathController {

    @Autowired
    private AirFlightPathService<AirFlightPath> flightPathService;

    @PostMapping("add")
    @ApiOperation("添加")
    ResultVo<AirFlightPath> add(@RequestBody AirFlightPath entity) throws Exception {
        AirFlightPath flightPath = flightPathService.add(entity);
        return ResultVo.ok(flightPath);
    }

    @GetMapping("delete")
    @ApiOperation("删除")
    ResultVo<String> delete(String entityId) throws Exception {
        String delete = String.valueOf(flightPathService.delete(entityId));
        return ResultVo.ok(delete);
    }

    @PostMapping("edit")
    @ApiOperation("修改")
    ResultVo<AirFlightPath> edit(@RequestBody AirFlightPath edit) throws Exception {
        AirFlightPath flightPath = flightPathService.edit(edit);
        return ResultVo.ok(flightPath);
    }

    @GetMapping("findOne")
    @ApiOperation("查询一条")
    ResultVo<AirFlightPath> findOne(String entityId) throws Exception {
        AirFlightPath flightPath = flightPathService.findOne(entityId);
        return ResultVo.ok(flightPath);
    }

//    @GetMapping("findPage")
//    @ApiOperation("分页查询列表")
//    ResultVo<PageVo<AirFlightPath>> findPage(Integer page, Integer pageSize
//            , String icao, String startTime, String endTime
//            , String keyword, String fields
//            , String oderByField, Boolean orderByAsc) {
//        PageVo<AirFlightPath> pageVo = flightPathService.findPage(page, pageSize
//                , icao, startTime, endTime
//                , keyword, fields, oderByField, orderByAsc);
//        return ResultVo.ok(pageVo);
//    }
@GetMapping("findPage")
@ApiOperation("分页查询列表")
ResultVo<PageVo<AirFlightPath>> findPage(Integer page, Integer pageSize
        , String keyword, String fields
        , String oderByField, Boolean orderByAsc) {
    PageVo<AirFlightPath> pageVo = flightPathService.findPage(page, pageSize, keyword, fields, oderByField, orderByAsc);
    return ResultVo.ok(pageVo);
}

}
